package org.ushio.nchu_22201404.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.ushio.common_module.entity.CustomerServiceRecord;
import org.ushio.nchu_22201404.service.ServiceOnlineRecordService;

import java.util.List;

@CrossOrigin(origins = "http://localhost:8080")
@RestController
public class ServiceOnlineRecordController {
    @Autowired
    private ServiceOnlineRecordService serviceOnlineRecordService;

    @RequestMapping("/serviceOnlineInsert")
    public String serviceOnlineRecordInsert(@RequestBody CustomerServiceRecord customerServiceRecord){
        serviceOnlineRecordService.serviceOnlineRecordInsert(customerServiceRecord);
        return "service Online Record Insert success";
    }

    @RequestMapping("/serviceOnlineRecordToCustomerService")
    public List<CustomerServiceRecord> getServiceOnlineRecordToCustomerService(){
        return serviceOnlineRecordService.getServiceOnlineRecordToCustomerService();
    }

    @RequestMapping("/serviceOnlineRecordToAdmin")
    public List<CustomerServiceRecord> getServiceOnlineRecordToAdmin(){
        return serviceOnlineRecordService.getServiceOnlineRecordToAdmin();
    }

    @RequestMapping("/serviceOnlineRecordByPhoneNumber")
    public List<CustomerServiceRecord> getServiceOnlineRecordByPhoneNumber(@RequestParam String phoneNumber){
        return serviceOnlineRecordService.getServiceOnlineRecordByPhoneNumber(phoneNumber);
    }
}
